
<div  ng-controller="backendServiceUserCtrl">
    <div>
        <br>
        <!--a ng-click="addUser()" class="btn-primary btn-sm nodecoration">新建用户</a-->
        <br>
        <br>
        <table class="table table-condensed" width="647">
            <thead>
            <tr>
                <th width="15%">用户ID</th>
                <th width="30%">用户名</th>
                <th width="20%">身份</th>
                <!--th width="15%">密码</th-->
                <th width="15%">应用登录名</th>
                <th width="15%">小区</th>
                <th width="20%" class="align-right">是否启用</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="backendUser in backendUserList">
                <td>{{backendUser.loginId}}</td>
                <td>{{backendUser.userName}}</td>
                <td>{{backendUser.role}}</td>
                <!--td>********</td-->
                <td>{{backendUser.appuser.mobilePhone}}</td>
                <td >
                    <div ng-repeat="community in backendUser.communities"><span class="community_count">{{community.communityName}}</span></div>
                </td>
                <td><input type="checkbox" name="community_sign" class="community_sign" ng-model="backendUser.signed" ng-click="onChecked(backendUser,backendUser.signed)"/></td>
                <!--td class="align-right">
                    <a class="btn btn-danger btn-xs"  ng-click="updateUser(backendUser.loginId)">Edit</a>
                    <a class="btn btn-danger btn-xs"  ng-click="deleteUser(backendUser.loginId)" ng-show="backendUser.loginId!='admin'">Delete</a>
                </td-->
            </tr>
            <tr>
                <td colspan="5" align="center" ></td>
            </tr>
            </tbody>
        </table>
        <a ng-click="onApply()" class="btn-primary btn-sm nodecoration">应用</a>
    </div>


    <div class="modal fade" id="user_modal" tabindex="-1"  role="dialog" aria-labelledby="helpModalLabel"  aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h5 class="modal-title" id="myModalLabel">{{popupTitle}}</h5>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" name="backendUserForm">
                        <div class="form-group">
                            <label for="inputLoginId" class="control-label col-xs-2">用户ID:</label>
                            <div class="col-xs-3">
                                <input type="text" class="form-control"  ng-model="backendUser.loginId" id="loginId" required placeholder="loginId">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputUserName" class="control-label col-xs-2">用户名:</label>
                            <div class="col-xs-3">
                                <input type="text" class="form-control" ng-model="backendUser.userName" id="userName" required placeholder="userName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-2" for="role">身份:</label>
                            <div class="col-xs-2">
                                <select id="role_select" class="form-control" ng-model="backendUser.role" placeholder="UserRole" required tabindex="4">
                                    <option></option>
                                    <option>Admin</option>
                                    <option>Operation</option>
                                    <option>Service</option>
                                    <option>Guest</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group"  ng-class="{ 'has-error' : backendUserForm.password.$invalid && !backendUserForm.password.$pristine }">
                            <label for="inputPassword" class="control-label col-xs-2">密码:</label>
                            <div class="col-xs-4">
                                <input type="password" class="form-control" ng-model="backendUser.password" id="password" name="password" ng-minlength="6" ng-maxlength="16" required placeholder="Password" ng-change="changePasswordValue()">
                            </div>
                            <p ng-show="backendUserForm.password.$error.minlength" class="help-block">Password is too short.</p>
                            <p ng-show="backendUserForm.password.$error.maxlength" class="help-block">Password is too long.</p>
                        </div>
                        <div class="form-group"  ng-class="{ 'has-error' : backendUserForm.password2.$invalid && !backendUserForm.password2.$pristine  }">
                            <label for="inputPassword2" class="control-label col-xs-2">再输入一遍:</label>
                            <div class="col-xs-4">
                                <input type="password" class="form-control" ng-model="backendUser.password2" id="inputPassword2" name="password2" ng-minlength="6" ng-maxlength="16"  required placeholder="Password Repeat" ng-change="changePassword2Value()">
                            </div>
                            <p ng-show="backendUserForm.password2.$error.minlength" class="help-block">Password is too short.</p>
                            <p ng-show="backendUserForm.password2.$error.maxlength" class="help-block">Password is too long.</p>
                            <p ng-show="matchFlag==false" class="help-block">Password match error.</p>
                        </div>
                        <div id="service_options" ng-show="backendUser.role=='Service'" class="form-group">
                            <label  class="control-label col-xs-2" >选择小区:</label>
                            <div class="col-xs-4" class="form-control">
                                <select id="communities_select"  style="width:200px" MULTIPLE SIZE=5>
                                </select>
                            </div>
                            <label  class="control-label col-xs-2" class="form-control">小6客服用户:</label>
                            <div class="col-xs-4">
                                <select id="user_select" style="width:200px"  SIZE=5>

                                </select>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button id="saveButton" type="submit" class="btn btn-default" ng-click="saveAdd(backendUser)">保存</button>
                            <button id="updateButton" type="submit" class="btn btn-default" ng-click="saveUpdate(backendUser.loginId,backendUser)">修改</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>